home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / asywiz / example.asm < prev    next >
Assembly Source File  |  1994-11-03  |  14KB  |  278 lines

  1. comment $
  2.  
  3.    +----------------------------------------------------------------------+
  4.    |                                                                      |
  5.    |        AsmWiz  Copyright (c) 1990-1994  Thomas G. Hanlin III         |
  6.    |                                                                      |
  7.    |                          AsmWiz Demo Program                         |
  8.    |                                                                      |
  9.    |                        assembled with MASM 6.0                       |
  10.    |                                                                      |
  11.    +----------------------------------------------------------------------+
  12.  
  13.    The code here has been designed to be easily understandable and is not as
  14.    efficient as the coding used in the actual library.
  15. $
  16.  
  17.  
  18. ; the use of a dummy stack segment here eliminates the meaningless error
  19. ; message from LINK about there being no stack defined.
  20.  
  21. Sseg          segment byte stack 'prog'     ; dummy stack segment
  22. Sseg          ends
  23.  
  24. Cseg          segment byte public 'prog'
  25.  
  26.               assume cs:Cseg, ds:Cseg, ss:Sseg
  27.  
  28.               org            100h
  29.  
  30.  
  31.  
  32. extrn  BKO_GETKEY:near, MD_DONE:near, MD_DELAY:near, MD_INIT:near
  33. extrn  MV_INIT:near, MV_LOCATE:near, MV_MODE:near, MV_GETMODE:near
  34. extrn  MV_POPUP:near, MV_STROUT:near, MV_HIDECURSOR:near
  35. extrn  MV_SHOWCURSOR:near, MV_STROUT:near, MV_INSLINE:near, MV_DELLINE:near
  36. extrn  MV_INSCHR:near, MV_DELCHR:near, MV_COLOR:near, MV_CLS:near
  37. extrn  MV_FIXCOLOR:near, MV_FRAME:near, MI_GETSCREEN:near, MI_PARSE:near
  38. extrn  S0_LENGTH:near, S0_UPCASES:near
  39.  
  40.  
  41.  
  42. MAIN          proc           far       ; AsmWiz example program
  43.               call           Initialize     ; initialize screen and colors
  44.               call           ShowWelcome    ; display welcome message
  45.               call           SlideWelcome   ; slide welcome message left
  46.               call           ShowWindow     ; display pop-up window w/ text
  47.               call           ShowCopyright  ; display copyright message
  48.               call           WaitOnKey      ; display "press any" and wait
  49.               call           Terminate      ; restore original screen mode, etc
  50.               mov            ax,4C00h       ;
  51.               int            21h            ; exit program
  52. MAIN          endp                     ; AsmWiz example program
  53.  
  54.  
  55.  
  56. Initialize    proc           near      ; initialize the screen
  57.               call           MV_GETMODE     ; get current screen mode
  58.               mov            OldMode,al     ; save it
  59.               call           MV_INIT        ; initialize display routines
  60.               mov            al,3           ; mode 3: 80x25 color text
  61.               call           MV_MODE        ; set display mode
  62.               call           MV_HIDECURSOR  ; turn off the cursor
  63.               mov            si,0080h       ; pointer to the command line
  64.               lea            di,FileBuf     ; pointer to filename buffer
  65.               lea            bx,OptBuf      ; pointer to option buffer
  66.               mov            al,"/"         ; use normal DOS switch character
  67.               call           MI_PARSE       ; parse the command line
  68.               or             ah,ah          ; is there an option?
  69.               jz             CheckCRT       ;   no, go check the CRT type
  70.               mov            si,bx          ; pointer to first option
  71.               mov            di,bx          ;
  72.               call           S0_UPCASES     ; convert it to uppercase
  73.               cmp byte ptr   [bx],"B"       ; is it /B for monochrome mode?
  74.               jne            CheckCRT       ;   no, check CRT type
  75.               mov            al,1           ; set to mono
  76.               jmp            SetCRT         ;   go set type
  77. CheckCRT:     call           MI_GETSCREEN   ; see what the screen type is
  78. SetCRT:       call           MV_FIXCOLOR    ; set the color handler to suit
  79.               mov            al,1Fh         ; bright white on blue
  80.               call           MV_COLOR       ; set text color
  81.               call           MV_CLS         ; clear screen to new color
  82.               call           MD_INIT        ; initialize hi-res timer system
  83.               ret                           ;
  84. Initialize    endp                     ; initialize the screen
  85.  
  86.  
  87.  
  88. ShowWelcome   proc           near      ; display welcome message
  89.               mov            dx,0125h       ; row 1, column 37
  90.               call           MV_LOCATE      ; set cursor location
  91.               lea            dx,WelcomeMsg  ; ptr to "Welcome"
  92.               call           MV_STROUT      ; display it
  93.               mov            cx,8           ;
  94. Welcome1:     call           MV_INSLINE     ; scroll it down
  95.               push           cx             ;
  96.               mov            cx,4           ;
  97.               call           MD_DELAY       ; delay 4/100ths of a second
  98.               pop            cx             ;
  99.               loop           Welcome1       ; ...nine times
  100.               mov            dx,0B25h       ; row 11, column 37
  101.               call           MV_LOCATE      ; set cursor location
  102.               lea            dx,ToTheMsg    ; ptr to "to the"
  103.               call           MV_STROUT      ; display it
  104.               mov            dx,0D01h       ; row 13, column 1
  105.               call           MV_LOCATE      ; set cursor location
  106.               lea            dx,AsmMsg      ; ptr to "Asm" <cr>
  107.               call           MV_STROUT      ; display it
  108.               mov            cx,37          ;
  109. Welcome2:     call           MV_INSCHR      ; scroll it right
  110.               push           cx             ;
  111.               mov            cx,2           ;
  112.               call           MD_DELAY       ; delay 2/100ths of a second
  113.               pop            cx             ;
  114.               loop           Welcome2       ; ...37 times
  115.               mov            dx,0D4Dh       ; row 13, column 73
  116.               call           MV_LOCATE      ;
  117.               lea            dx,WizMsg      ; ptr to "Wiz"
  118.               call           MV_STROUT      ; display it
  119.               mov            dx,0D29h       ; row 13, column 41
  120.               call           MV_LOCATE      ; set cursor location
  121.               mov            cx,36          ;
  122. Welcome3:     call           MV_DELCHR      ; scroll it left
  123.               push           cx             ;
  124.               mov            cx,2           ;
  125.               call           MD_DELAY       ; delay 2/100ths of a second
  126.               pop            cx             ;
  127.               loop           Welcome3       ; ...36 times
  128.               mov            dx,1925h       ; row 25, column 37
  129.               call           MV_LOCATE      ; set cursor location
  130.               lea            dx,LibraryMsg  ; ptr to "Library"
  131.               call           MV_STROUT      ; display it
  132.               mov            dx,0E01h       ; row 14, column 1
  133.               call           MV_LOCATE      ; set cursor location
  134.               mov            cx,10          ;
  135. Welcome4:     call           MV_DELLINE     ; scroll it up
  136.               push           cx             ;
  137.               mov            cx,4           ;
  138.               call           MD_DELAY       ; delay 4/100ths of a second
  139.               pop            cx             ;
  140.               loop           Welcome4       ; ...10 times
  141.               mov            cx,200         ; delay 200/100ths of a second
  142.               call           MD_DELAY       ;
  143.               ret                           ;
  144. ShowWelcome   endp                     ; display welcome message
  145.  
  146.  
  147.  
  148. SlideWelcome  proc           near      ; slide welcome message left
  149.               mov            dx,0901h       ; row 9, column 1
  150.               mov            ax,4           ;
  151. ScrollAll:    mov            cx,20          ; columns to scroll
  152. LineLeft:     call           MV_LOCATE      ; set cursor position
  153.               call           MV_DELCHR      ; scroll it left
  154.               loop           LineLeft       ;   go fo